package traits

trait TLeveleable {

  var level = 1
  var currentExperience = 0
  var neededExpToLevelup = 100
  
  def gainExp(exp :Int) :Unit = {
    currentExperience+= exp
    if (currentExperience>= neededExpToLevelup) {
      level+=1
      neededExpToLevelup = neededExpToLevelup*2	
      gainExp(exp - neededExpToLevelup)
    }
  }
}